home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 January: Technology Seed / Jan. '98 ATS.toast / QuickTime™ 3.0b11 / QTPublicInterfaces / CIncludes / MacWindows.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-01-12  |  26.6 KB  |  796 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        MacWindows.h
  3.  
  4.      Contains:    Window Manager Interfaces.
  5.  
  6.      Version:    Technology:    System 7.5
  7.                  Release:    QuickTime 3.0 Beta
  8.  
  9.      Copyright:    © 1997 by Apple Computer, Inc., all rights reserved
  10.  
  11.      Bugs?:        Please include the the file and version information (from above) with
  12.                  the problem description.  Developers belonging to one of the Apple
  13.                  developer programs can submit bug reports to:
  14.  
  15.                      devsupport@apple.com
  16.  
  17. */
  18. #ifndef __MACWINDOWS__
  19. #define __MACWINDOWS__
  20.  
  21. #ifndef __MACTYPES__
  22. #include <MacTypes.h>
  23. #endif
  24. #ifndef __MIXEDMODE__
  25. #include <MixedMode.h>
  26. #endif
  27. #ifndef __QUICKDRAW__
  28. #include <Quickdraw.h>
  29. #endif
  30. #ifndef __EVENTS__
  31. #include <Events.h>
  32. #endif
  33. #ifndef __CONTROLS__
  34. #include <Controls.h>
  35. #endif
  36.  
  37.  
  38.  
  39. #if PRAGMA_ONCE
  40. #pragma once
  41. #endif
  42.  
  43. #ifdef __cplusplus
  44. extern "C" {
  45. #endif
  46.  
  47. #if PRAGMA_IMPORT
  48. #pragma import on
  49. #endif
  50.  
  51. #if PRAGMA_STRUCT_ALIGN
  52.     #pragma options align=mac68k
  53. #elif PRAGMA_STRUCT_PACKPUSH
  54.     #pragma pack(push, 2)
  55. #elif PRAGMA_STRUCT_PACK
  56.     #pragma pack(2)
  57. #endif
  58.  
  59. /*
  60.   _________________________________________________________________________________________________________
  61.       
  62.    • WINDOW DEFINITION TYPE
  63.   _________________________________________________________________________________________________________
  64. */
  65.  
  66. enum {
  67.     kWindowDefProcType            = FOUR_CHAR_CODE('WDEF')
  68. };
  69.  
  70. /*
  71.   _________________________________________________________________________________________________________
  72.       
  73.    • WINDOW DEFINITION ID'S
  74.   _________________________________________________________________________________________________________
  75. */
  76.  
  77.  
  78. enum {
  79.     kStandardWindowDefinition    = 0,                            /* for document windows and dialogs*/
  80.     kRoundWindowDefinition        = 1,                            /* old da-style window*/
  81.     kFloatingWindowDefinition    = 124                            /* for floating windows*/
  82. };
  83.  
  84. /*
  85.   _________________________________________________________________________________________________________
  86.       
  87.    • VARIANT CODES
  88.   _________________________________________________________________________________________________________
  89. */
  90.  
  91.  
  92. enum {
  93.                                                                 /* for use with kStandardWindowDefinition */
  94.     kDocumentWindowVariantCode    = 0,
  95.     kModalDialogVariantCode        = 1,
  96.     kPlainDialogVariantCode        = 2,
  97.     kShadowDialogVariantCode    = 3,
  98.     kMovableModalDialogVariantCode = 5,
  99.     kAlertVariantCode            = 7,
  100.     kMovableAlertVariantCode    = 9,                            /* for use with kFloatingWindowDefinition */
  101.     kSideFloaterVariantCode        = 8
  102. };
  103.  
  104. /*
  105.   _________________________________________________________________________________________________________
  106.       
  107.    • PROC-ID'S
  108.   _________________________________________________________________________________________________________
  109. */
  110.  
  111.  
  112. enum {
  113.     documentProc                = 0,
  114.     dBoxProc                    = 1,
  115.     plainDBox                    = 2,
  116.     altDBoxProc                    = 3,
  117.     noGrowDocProc                = 4,
  118.     movableDBoxProc                = 5,
  119.     zoomDocProc                    = 8,
  120.     zoomNoGrow                    = 12,
  121.     rDocProc                    = 16,                            /* floating window defproc ids */
  122.     floatProc                    = 1985,
  123.     floatGrowProc                = 1987,
  124.     floatZoomProc                = 1989,
  125.     floatZoomGrowProc            = 1991,
  126.     floatSideProc                = 1993,
  127.     floatSideGrowProc            = 1995,
  128.     floatSideZoomProc            = 1997,
  129.     floatSideZoomGrowProc        = 1999
  130. };
  131.  
  132. /*
  133.   _________________________________________________________________________________________________________
  134.       
  135.    • STANDARD WINDOW KINDS
  136.   _________________________________________________________________________________________________________
  137. */
  138.  
  139.  
  140. enum {
  141.     dialogKind                    = 2,
  142.     userKind                    = 8,
  143.     kDialogWindowKind            = 2,
  144.     kApplicationWindowKind        = 8
  145. };
  146.  
  147.  
  148. /*
  149.   _________________________________________________________________________________________________________
  150.       
  151.    • FIND WINDOW RESULT CODES
  152.   _________________________________________________________________________________________________________
  153. */
  154.  
  155.  
  156. enum {
  157.     inDesk                        = 0,
  158.     inNoWindow                    = 0,
  159.     inMenuBar                    = 1,
  160.     inSysWindow                    = 2,
  161.     inContent                    = 3,
  162.     inDrag                        = 4,
  163.     inGrow                        = 5,
  164.     inGoAway                    = 6,
  165.     inZoomIn                    = 7,
  166.     inZoomOut                    = 8
  167. };
  168.  
  169.  
  170. enum {
  171.     wDraw                        = 0,
  172.     wHit                        = 1,
  173.     wCalcRgns                    = 2,
  174.     wNew                        = 3,
  175.     wDispose                    = 4,
  176.     wGrow                        = 5,
  177.     wDrawGIcon                    = 6
  178. };
  179.  
  180.  
  181. enum {
  182.     deskPatID                    = 16
  183. };
  184.  
  185. /*
  186.   _________________________________________________________________________________________________________
  187.       
  188.    • WINDOW DEFINITION HIT TEST RESULT CODES ("WINDOW PART")
  189.   _________________________________________________________________________________________________________
  190. */
  191.  
  192.  
  193. enum {
  194.     wNoHit                        = 0,
  195.     wInContent                    = 1,
  196.     wInDrag                        = 2,
  197.     wInGrow                        = 3,
  198.     wInGoAway                    = 4,
  199.     wInZoomIn                    = 5,
  200.     wInZoomOut                    = 6
  201. };
  202.  
  203. /*
  204.   _________________________________________________________________________________________________________
  205.       
  206.    • WINDOW COLOR PART CODES
  207.   _________________________________________________________________________________________________________
  208. */
  209.  
  210.  
  211. enum {
  212.     wContentColor                = 0,
  213.     wFrameColor                    = 1,
  214.     wTextColor                    = 2,
  215.     wHiliteColor                = 3,
  216.     wTitleBarColor                = 4
  217. };
  218.  
  219. /*
  220.   _________________________________________________________________________________________________________
  221.    • WINDOW COLOR TABLE STRUCTURE
  222.   _________________________________________________________________________________________________________
  223. */
  224.  
  225.  
  226. struct WinCTab {
  227.     long                             wCSeed;                        /* reserved */
  228.     short                             wCReserved;                    /* reserved */
  229.     short                             ctSize;                        /* usually 4 for windows */
  230.     ColorSpec                         ctTable[5];
  231. };
  232. typedef struct WinCTab                    WinCTab;
  233.  
  234. typedef WinCTab *                        WCTabPtr;
  235. typedef WCTabPtr *                        WCTabHandle;
  236. /*
  237.   _________________________________________________________________________________________________________
  238.    • WINDOWRECORD
  239.   _________________________________________________________________________________________________________
  240. */
  241. typedef struct WindowRecord             WindowRecord;
  242. typedef WindowRecord *                    WindowPeek;
  243.  
  244. struct WindowRecord {
  245.     GrafPort                         port;
  246.     short                             windowKind;
  247.     Boolean                         visible;
  248.     Boolean                         hilited;
  249.     Boolean                         goAwayFlag;
  250.     Boolean                         spareFlag;
  251.     RgnHandle                         strucRgn;
  252.     RgnHandle                         contRgn;
  253.     RgnHandle                         updateRgn;
  254.     Handle                             windowDefProc;
  255.     Handle                             dataHandle;
  256.     StringHandle                     titleHandle;
  257.     short                             titleWidth;
  258.     ControlHandle                     controlList;
  259.     WindowPeek                         nextWindow;
  260.     PicHandle                         windowPic;
  261.     long                             refCon;
  262. };
  263.  
  264. /*
  265.   _________________________________________________________________________________________________________
  266.    • CWINDOWRECORD
  267.   _________________________________________________________________________________________________________
  268. */
  269. typedef struct CWindowRecord             CWindowRecord;
  270. typedef CWindowRecord *                    CWindowPeek;
  271.  
  272. struct CWindowRecord {
  273.     CGrafPort                         port;
  274.     short                             windowKind;
  275.     Boolean                         visible;
  276.     Boolean                         hilited;
  277.     Boolean                         goAwayFlag;
  278.     Boolean                         spareFlag;
  279.     RgnHandle                         strucRgn;
  280.     RgnHandle                         contRgn;
  281.     RgnHandle                         updateRgn;
  282.     Handle                             windowDefProc;
  283.     Handle                             dataHandle;
  284.     StringHandle                     titleHandle;
  285.     short                             titleWidth;
  286.     ControlHandle                     controlList;
  287.     CWindowPeek                     nextWindow;
  288.     PicHandle                         windowPic;
  289.     long                             refCon;
  290. };
  291.  
  292. /*
  293.   _________________________________________________________________________________________________________
  294.    • AUXWINDHANDLE
  295.   _________________________________________________________________________________________________________
  296. */
  297. typedef struct AuxWinRec                 AuxWinRec;
  298. typedef AuxWinRec *                        AuxWinPtr;
  299. typedef AuxWinPtr *                        AuxWinHandle;
  300.  
  301. struct AuxWinRec {
  302.     AuxWinHandle                     awNext;                        /*handle to next AuxWinRec*/
  303.     WindowPtr                         awOwner;                    /*ptr to window */
  304.     CTabHandle                         awCTable;                    /*color table for this window*/
  305.     Handle                             reserved;
  306.     long                             awFlags;                    /*reserved for expansion*/
  307.     CTabHandle                         awReserved;                    /*reserved for expansion*/
  308.     long                             awRefCon;                    /*user Constant*/
  309. };
  310.  
  311. /*
  312.   _________________________________________________________________________________________________________
  313.    • WSTATEHANDLE
  314.   _________________________________________________________________________________________________________
  315. */
  316.  
  317. struct WStateData {
  318.     Rect                             userState;                    /*user state*/
  319.     Rect                             stdState;                    /*standard state*/
  320. };
  321. typedef struct WStateData                WStateData;
  322. typedef WStateData *                    WStateDataPtr;
  323. typedef WStateDataPtr *                    WStateDataHandle;
  324. /*
  325.   _________________________________________________________________________________________________________
  326.       
  327.    • API
  328.   _________________________________________________________________________________________________________
  329. */
  330. EXTERN_API( void )
  331. InitWindows                        (void)                                                        ONEWORDINLINE(0xA912);
  332.  
  333. EXTERN_API( WindowPtr )
  334. NewWindow                        (void *                    wStorage,
  335.                                  const Rect *            boundsRect,
  336.                                  ConstStr255Param         title,
  337.                                  Boolean                 visible,
  338.                                  short                     theProc,
  339.                                  WindowPtr                 behind,
  340.                                  Boolean                 goAwayFlag,
  341.                                  long                     refCon)                                ONEWORDINLINE(0xA913);
  342.  
  343. EXTERN_API( WindowPtr )
  344. GetNewWindow                    (short                     windowID,
  345.                                  void *                    wStorage,
  346.                                  WindowPtr                 behind)                                ONEWORDINLINE(0xA9BD);
  347.  
  348. EXTERN_API( WindowPtr )
  349. NewCWindow                        (void *                    wStorage,
  350.                                  const Rect *            boundsRect,
  351.                                  ConstStr255Param         title,
  352.                                  Boolean                 visible,
  353.                                  short                     procID,
  354.                                  WindowPtr                 behind,
  355.                                  Boolean                 goAwayFlag,
  356.                                  long                     refCon)                                ONEWORDINLINE(0xAA45);
  357.  
  358. EXTERN_API( void )
  359. DisposeWindow                    (WindowPtr                 theWindow)                            ONEWORDINLINE(0xA914);
  360.  
  361. EXTERN_API( void )
  362. MacCloseWindow                    (WindowPtr                 theWindow)                            ONEWORDINLINE(0xA92D);
  363.  
  364. EXTERN_API( void )
  365. InvalRect                        (const Rect *            badRect)                            ONEWORDINLINE(0xA928);
  366.  
  367. EXTERN_API( void )
  368. InvalRgn                        (RgnHandle                 badRgn)                                ONEWORDINLINE(0xA927);
  369.  
  370. EXTERN_API( void )
  371. ValidRect                        (const Rect *            goodRect)                            ONEWORDINLINE(0xA92A);
  372.  
  373. EXTERN_API( void )
  374. ValidRgn                        (RgnHandle                 goodRgn)                            ONEWORDINLINE(0xA929);
  375.  
  376. EXTERN_API( Boolean )
  377. CheckUpdate                        (EventRecord *            theEvent)                            ONEWORDINLINE(0xA911);
  378.  
  379. EXTERN_API( void )
  380. ClipAbove                        (WindowPtr                 window)                                ONEWORDINLINE(0xA90B);
  381.  
  382. EXTERN_API( void )
  383. SaveOld                            (WindowPtr                 window)                                ONEWORDINLINE(0xA90E);
  384.  
  385. EXTERN_API( void )
  386. DrawNew                            (WindowPtr                 window,
  387.                                  Boolean                 update)                                ONEWORDINLINE(0xA90F);
  388.  
  389. EXTERN_API( void )
  390. PaintOne                        (WindowPtr                 window,
  391.                                  RgnHandle                 clobberedRgn)                        ONEWORDINLINE(0xA90C);
  392.  
  393. EXTERN_API( void )
  394. PaintBehind                        (WindowPtr                 startWindow,
  395.                                  RgnHandle                 clobberedRgn)                        ONEWORDINLINE(0xA90D);
  396.  
  397. EXTERN_API( void )
  398. CalcVis                            (WindowPtr                 window)                                ONEWORDINLINE(0xA909);
  399.  
  400. EXTERN_API( void )
  401. CalcVisBehind                    (WindowPtr                 startWindow,
  402.                                  RgnHandle                 clobberedRgn)                        ONEWORDINLINE(0xA90A);
  403.  
  404. EXTERN_API( void )
  405. SetWinColor                        (WindowPtr                 theWindow,
  406.                                  WCTabHandle             newColorTable)                        ONEWORDINLINE(0xAA41);
  407.  
  408. EXTERN_API( void )
  409. SetDeskCPat                        (PixPatHandle             deskPixPat)                            ONEWORDINLINE(0xAA47);
  410.  
  411. EXTERN_API( WindowPtr )
  412. GetNewCWindow                    (short                     windowID,
  413.                                  void *                    wStorage,
  414.                                  WindowPtr                 behind)                                ONEWORDINLINE(0xAA46);
  415.  
  416. EXTERN_API( void )
  417. SetWTitle                        (WindowPtr                 theWindow,
  418.                                  ConstStr255Param         title)                                ONEWORDINLINE(0xA91A);
  419.  
  420. EXTERN_API( void )
  421. GetWTitle                        (WindowPtr                 theWindow,
  422.                                  Str255                 title)                                ONEWORDINLINE(0xA919);
  423.  
  424. EXTERN_API( void )
  425. GetWMgrPort                        (GrafPtr *                wPort)                                ONEWORDINLINE(0xA910);
  426.  
  427. EXTERN_API( void )
  428. GetCWMgrPort                    (CGrafPtr *                wMgrCPort)                            ONEWORDINLINE(0xAA48);
  429.  
  430. EXTERN_API( void )
  431. SetWRefCon                        (WindowPtr                 theWindow,
  432.                                  long                     data)                                ONEWORDINLINE(0xA918);
  433.  
  434. EXTERN_API( long )
  435. GetWRefCon                        (WindowPtr                 theWindow)                            ONEWORDINLINE(0xA917);
  436.  
  437. EXTERN_API( void )
  438. SelectWindow                    (WindowPtr                 theWindow)                            ONEWORDINLINE(0xA91F);
  439.  
  440. EXTERN_API( void )
  441. HideWindow                        (WindowPtr                 theWindow)                            ONEWORDINLINE(0xA916);
  442.  
  443. EXTERN_API( void )
  444. MacShowWindow                    (WindowPtr                 theWindow)                            ONEWORDINLINE(0xA915);
  445.  
  446. EXTERN_API( void )
  447. ShowHide                        (WindowPtr                 theWindow,
  448.                                  Boolean                 showFlag)                            ONEWORDINLINE(0xA908);
  449.  
  450. EXTERN_API( void )
  451. HiliteWindow                    (WindowPtr                 theWindow,
  452.                                  Boolean                 fHilite)                            ONEWORDINLINE(0xA91C);
  453.  
  454. EXTERN_API( void )
  455. BringToFront                    (WindowPtr                 theWindow)                            ONEWORDINLINE(0xA920);
  456.  
  457. EXTERN_API( void )
  458. SendBehind                        (WindowPtr                 theWindow,
  459.                                  WindowPtr                 behindWindow)                        ONEWORDINLINE(0xA921);
  460.  
  461. EXTERN_API( WindowPtr )
  462. FrontWindow                        (void)                                                        ONEWORDINLINE(0xA924);
  463.  
  464. EXTERN_API( void )
  465. DrawGrowIcon                    (WindowPtr                 theWindow)                            ONEWORDINLINE(0xA904);
  466.  
  467. EXTERN_API( void )
  468. MacMoveWindow                    (WindowPtr                 theWindow,
  469.                                  short                     hGlobal,
  470.                                  short                     vGlobal,
  471.                                  Boolean                 front)                                ONEWORDINLINE(0xA91B);
  472.  
  473. EXTERN_API( void )
  474. SizeWindow                        (WindowPtr                 theWindow,
  475.                                  short                     w,
  476.                                  short                     h,
  477.                                  Boolean                 fUpdate)                            ONEWORDINLINE(0xA91D);
  478.  
  479. EXTERN_API( void )
  480. ZoomWindow                        (WindowPtr                 theWindow,
  481.                                  short                     partCode,
  482.                                  Boolean                 front)                                ONEWORDINLINE(0xA83A);
  483.  
  484. EXTERN_API( void )
  485. BeginUpdate                        (WindowPtr                 theWindow)                            ONEWORDINLINE(0xA922);
  486.  
  487. EXTERN_API( void )
  488. EndUpdate                        (WindowPtr                 theWindow)                            ONEWORDINLINE(0xA923);
  489.  
  490. EXTERN_API( void )
  491. SetWindowPic                    (WindowPtr                 theWindow,
  492.                                  PicHandle                 pic)                                ONEWORDINLINE(0xA92E);
  493.  
  494. EXTERN_API( PicHandle )
  495. GetWindowPic                    (WindowPtr                 theWindow)                            ONEWORDINLINE(0xA92F);
  496.  
  497. EXTERN_API( long )
  498. GrowWindow                        (WindowPtr                 theWindow,
  499.                                  Point                     startPt,
  500.                                  const Rect *            bBox)                                ONEWORDINLINE(0xA92B);
  501.  
  502. EXTERN_API( short )
  503. MacFindWindow                    (Point                     thePoint,
  504.                                  WindowPtr *            theWindow)                            ONEWORDINLINE(0xA92C);
  505.  
  506. EXTERN_API( long )
  507. PinRect                            (const Rect *            theRect,
  508.                                  Point                     thePt)                                ONEWORDINLINE(0xA94E);
  509.  
  510. EXTERN_API( long )
  511. DragGrayRgn                        (RgnHandle                 theRgn,
  512.                                  Point                     startPt,
  513.                                  const Rect *            limitRect,
  514.                                  const Rect *            slopRect,
  515.                                  short                     axis,
  516.                                  DragGrayRgnUPP         actionProc)                            ONEWORDINLINE(0xA905);
  517.  
  518. EXTERN_API( long )
  519. DragTheRgn                        (RgnHandle                 theRgn,
  520.                                  Point                     startPt,
  521.                                  const Rect *            limitRect,
  522.                                  const Rect *            slopRect,
  523.                                  short                     axis,
  524.                                  DragGrayRgnUPP         actionProc)                            ONEWORDINLINE(0xA926);
  525.  
  526. EXTERN_API( Boolean )
  527. TrackBox                        (WindowPtr                 theWindow,
  528.                                  Point                     thePt,
  529.                                  short                     partCode)                            ONEWORDINLINE(0xA83B);
  530.  
  531. EXTERN_API( Boolean )
  532. TrackGoAway                        (WindowPtr                 theWindow,
  533.                                  Point                     thePt)                                ONEWORDINLINE(0xA91E);
  534.  
  535. EXTERN_API( void )
  536. DragWindow                        (WindowPtr                 theWindow,
  537.                                  Point                     startPt,
  538.                                  const Rect *            boundsRect)                            ONEWORDINLINE(0xA925);
  539.  
  540. EXTERN_API( short )
  541. GetWVariant                        (WindowPtr                 theWindow)                            ONEWORDINLINE(0xA80A);
  542.  
  543. EXTERN_API( Boolean )
  544. GetAuxWin                        (WindowPtr                 theWindow,
  545.                                  AuxWinHandle *            awHndl)                                ONEWORDINLINE(0xAA42);
  546.  
  547. EXTERN_API( RgnHandle )
  548. GetGrayRgn                        (void)                                                        TWOWORDINLINE(0x2EB8, 0x09EE);
  549.  
  550. /*
  551.   _________________________________________________________________________________________________________
  552.       
  553.    • PROCS
  554.   _________________________________________________________________________________________________________
  555. */
  556.  
  557. typedef CALLBACK_API( long , WindowDefProcPtr )(short varCode, WindowPtr theWindow, short message, long param);
  558. typedef CALLBACK_API( void , DeskHookProcPtr )(Boolean mouseClick, EventRecord *theEvent);
  559. /*
  560.     WARNING: DeskHookProcPtr uses register based parameters under classic 68k
  561.              and cannot be written in a high-level language without 
  562.              the help of mixed mode or assembly glue.
  563. */
  564. typedef STACK_UPP_TYPE(WindowDefProcPtr)                         WindowDefUPP;
  565. typedef REGISTER_UPP_TYPE(DeskHookProcPtr)                         DeskHookUPP;
  566. enum { uppWindowDefProcInfo = 0x00003BB0 };                     /* pascal 4_bytes Func(2_bytes, 4_bytes, 2_bytes, 4_bytes) */
  567. enum { uppDeskHookProcInfo = 0x00130802 };                         /* register no_return_value Func(1_byte:D0, 4_bytes:A0) */
  568. #define NewWindowDefProc(userRoutine)                             (WindowDefUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppWindowDefProcInfo, GetCurrentArchitecture())
  569. #define NewDeskHookProc(userRoutine)                             (DeskHookUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppDeskHookProcInfo, GetCurrentArchitecture())
  570. #define CallWindowDefProc(userRoutine, varCode, theWindow, message, param)  CALL_FOUR_PARAMETER_UPP((userRoutine), uppWindowDefProcInfo, (varCode), (theWindow), (message), (param))
  571. #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  572.     #pragma parameter CallDeskHookProc(__A1, __D0, __A0)
  573.     void CallDeskHookProc(DeskHookUPP routine, Boolean mouseClick, EventRecord * theEvent) = 0x4E91;
  574. #else
  575.     #define CallDeskHookProc(userRoutine, mouseClick, theEvent)  CALL_TWO_PARAMETER_UPP((userRoutine), uppDeskHookProcInfo, (mouseClick), (theEvent))
  576. #endif
  577. /*
  578.   _________________________________________________________________________________________________________
  579.       
  580.    • C GLUE
  581.   _________________________________________________________________________________________________________
  582. */
  583. #if CGLUESUPPORTED
  584. EXTERN_API_C( void )
  585. setwtitle                        (WindowPtr                 theWindow,
  586.                                  const char *            title);
  587.  
  588. EXTERN_API_C( Boolean )
  589. trackgoaway                        (WindowPtr                 theWindow,
  590.                                  Point *                thePt);
  591.  
  592. EXTERN_API_C( short )
  593. findwindow                        (Point *                thePoint,
  594.                                  WindowPtr *            theWindow);
  595.  
  596. EXTERN_API_C( void )
  597. getwtitle                        (WindowPtr                 theWindow,
  598.                                  char *                    title);
  599.  
  600. EXTERN_API_C( long )
  601. growwindow                        (WindowPtr                 theWindow,
  602.                                  Point *                startPt,
  603.                                  const Rect *            bBox);
  604.  
  605. EXTERN_API_C( WindowPtr )
  606. newwindow                        (void *                    wStorage,
  607.                                  const Rect *            boundsRect,
  608.                                  const char *            title,
  609.                                  Boolean                 visible,
  610.                                  short                     theProc,
  611.                                  WindowPtr                 behind,
  612.                                  Boolean                 goAwayFlag,
  613.                                  long                     refCon);
  614.  
  615. EXTERN_API_C( WindowPtr )
  616. newcwindow                        (void *                    wStorage,
  617.                                  const Rect *            boundsRect,
  618.                                  const char *            title,
  619.                                  Boolean                 visible,
  620.                                  short                     procID,
  621.                                  WindowPtr                 behind,
  622.                                  Boolean                 goAwayFlag,
  623.                                  long                     refCon);
  624.  
  625. EXTERN_API_C( long )
  626. pinrect                            (const Rect *            theRect,
  627.                                  Point *                thePt);
  628.  
  629. EXTERN_API_C( Boolean )
  630. trackbox                        (WindowPtr                 theWindow,
  631.                                  Point *                thePt,
  632.                                  short                     partCode);
  633.  
  634. EXTERN_API_C( long )
  635. draggrayrgn                        (RgnHandle                 theRgn,
  636.                                  Point *                startPt,
  637.                                  const Rect *            boundsRect,
  638.                                  const Rect *            slopRect,
  639.                                  short                     axis,
  640.                                  DragGrayRgnUPP         actionProc);
  641.  
  642. EXTERN_API_C( void )
  643. dragwindow                        (WindowPtr                 theWindow,
  644.                                  Point *                startPt,
  645.                                  const Rect *            boundsRect);
  646.  
  647. #endif  /* CGLUESUPPORTED */
  648.  
  649. /*
  650.   _________________________________________________________________________________________________________
  651.       
  652.    • WindowRecord accessor macros
  653.   _________________________________________________________________________________________________________
  654. */
  655. /*
  656.     *****************************************************************************
  657.     *                                                                           *
  658.     * The conditional STRICT_WINDOWS has been removed from this interface file. *
  659.     * The accessor macros to a WindowRecord are no longer necessary.            *
  660.     *                                                                           *
  661.     * All ≈Ref Types have reverted to their original Handle and Ptr Types.      *
  662.     *                                                                           *
  663.     *****************************************************************************
  664.  
  665.     Details:
  666.     The original purpose of the STRICT_ conditionals and accessor macros was to
  667.     help ease the transition to Copland.  Shared data structures are difficult
  668.     to coordinate in a preemptive multitasking OS.  By hiding the fields in a
  669.     WindowRecord and other data structures, we would begin the migration to the
  670.     discipline wherein system data structures are completely hidden from
  671.     applications.
  672.     
  673.     After many design reviews, we finally concluded that with this sort of
  674.     migration, the system could never tell when an application was no longer
  675.     peeking at a WindowRecord, and thus the data structure might never become
  676.     system owned.  Additionally, there were many other limitations in the
  677.     classic toolbox that were begging to be addressed.  The final decision was
  678.     to leave the traditional toolbox as a compatibility mode.
  679.     
  680.     We also decided to use the Handle and Ptr based types in the function
  681.     declarations.  For example, NewWindow now returns a WindowPtr rather than a
  682.     WindowRef.  The Ref types are still defined in the header files, so all
  683.     existing code will still compile exactly as it did before.  There are
  684.     several reasons why we chose to do this:
  685.     
  686.     - The importance of backwards compatibility makes it unfeasible for us to
  687.     enforce real opaque references in the implementation anytime in the
  688.     foreseeable future.  Therefore, any opaque data types (e.g. WindowRef,
  689.     ControlRef, etc.) in the documentation and header files would always be a
  690.     fake veneer of opacity.
  691.     
  692.     - There exists a significant base of books and sample code that neophyte
  693.     Macintosh developers use to learn how to program the Macintosh.  These
  694.     books and sample code all use direct data access.  Introducing opaque data
  695.     types at this point would confuse neophyte programmers more than it would
  696.     help them.
  697.     
  698.     - Direct data structure access is used by nearly all Macintosh developers. 
  699.     Changing the interfaces to reflect a false opacity would not provide any
  700.     benefit to these developers.
  701.     
  702.     - Accessor functions are useful in and of themselves as convenience
  703.     functions, without being tied to opaque data types.  We will complete and
  704.     document the Windows and Dialogs accessor functions in an upcoming release
  705.     of the interfaces.
  706. */
  707. #ifdef __cplusplus
  708. inline CGrafPtr    GetWindowPort(WindowPtr w)                     { return (CGrafPtr) w;                                                     }
  709. inline void        SetPortWindowPort(WindowPtr w)                {    MacSetPort( (GrafPtr) GetWindowPort(w)); }
  710. inline SInt16        GetWindowKind(WindowPtr w)                     { return ( *(SInt16 *)    (((UInt8 *) w) + sizeof(GrafPort)));             }
  711. inline void        SetWindowKind(WindowPtr    w, SInt16 wKind)    {  *(SInt16 *)    (((UInt8 *) w) + sizeof(GrafPort)) = wKind;              }
  712. inline Boolean        IsWindowHilited(WindowPtr w)                { return *(Boolean *)    (((UInt8 *) w) + sizeof(GrafPort) + 0x3);        }
  713. inline Boolean        GetWindowGoAwayFlag(WindowPtr w)            { return *(Boolean *)    (((UInt8 *) w) + sizeof(GrafPort) + 0x4);        }
  714. inline Boolean        GetWindowZoomFlag(WindowPtr w)                { return *(Boolean *)    (((UInt8 *) w) + sizeof(GrafPort) + 0x5);        }
  715. inline SInt16        GetWindowTitleWidth(WindowPtr w)                { return *(SInt16 *)(((UInt8 *) w) + sizeof(GrafPort) + 0x1E);            }
  716. #if TARGET_OS_MAC
  717. #define IsWindowVisible MacIsWindowVisible
  718. #define GetNextWindow MacGetNextWindow
  719. #endif
  720. inline void        GetWindowStructureRgn(WindowPtr w, RgnHandle r)    {    MacCopyRgn( *(RgnHandle *)(((UInt8 *) w) + sizeof(GrafPort) + 0x6), r );    }
  721. inline void        GetWindowContentRgn(WindowPtr w, RgnHandle r)    {    MacCopyRgn( *(RgnHandle *)(((UInt8 *) w) + sizeof(GrafPort) + 0xA), r );    }
  722. inline void        GetWindowUpdateRgn(WindowPtr w, RgnHandle r)    {    MacCopyRgn( *(RgnHandle *)(((UInt8 *) w) + sizeof(GrafPort) + 0xE), r );    }
  723. inline    Boolean        MacIsWindowVisible(WindowPtr w)                { return *(Boolean *)    (((UInt8 *) w) + sizeof(GrafPort) + 0x2);         }
  724. inline WindowPtr    MacGetNextWindow(WindowPtr w)                        { return *(WindowPtr *)    (((UInt8 *) w) + sizeof(GrafPort) + 0x24);        }
  725.  
  726. inline void    GetWindowStandardState(WindowPtr w, Rect *r)
  727. {    Rect *stateRects = (  (Rect *) (**(Handle *) (((UInt8 *) w) + sizeof(GrafPort) + 0x16)));
  728. if (stateRects != NULL)    *r = stateRects[1];        }
  729. inline void    SetWindowStandardState(WindowPtr w, const Rect *r)
  730. {     Rect *stateRects = (  (Rect *) (**(Handle *) (((UInt8 *) w) + sizeof(GrafPort) + 0x16)));
  731. if (stateRects != NULL)    stateRects[1] = *r;     }
  732. inline void    GetWindowUserState(WindowPtr w, Rect *r)
  733. {     Rect *stateRects = (  (Rect *) (**(Handle *) (((UInt8 *) w) + sizeof(GrafPort) + 0x16)));
  734. if (stateRects != NULL)    *r = stateRects[0]; }
  735. inline void    SetWindowUserState(WindowPtr w, const Rect *r)
  736. { Rect *stateRects = (  (Rect *) (**(Handle *) (((UInt8 *) w) + sizeof(GrafPort) + 0x16)));
  737. if (stateRects != NULL)    stateRects[0] = *r; }
  738. #else
  739. #define ShowHideWindow(w)                        ShowHide(w)
  740. #define GetWindowPort(w)                        ( (CGrafPtr) w)
  741. #define GetWindowKind(w)                        ( *(SInt16 *)    (((UInt8 *) w) + sizeof(GrafPort)))
  742. #define SetWindowKind(w, wKind)                ( *(SInt16 *)    (((UInt8 *) w) + sizeof(GrafPort)) = wKind )
  743. #define IsWindowHilited(w)                        ( *(Boolean *)    (((UInt8 *) w) + sizeof(GrafPort) + 0x3))
  744. #define GetWindowGoAwayFlag(w)                    ( *(Boolean *)    (((UInt8 *) w) + sizeof(GrafPort) + 0x4))
  745. #define GetWindowZoomFlag(w)                    ( *(Boolean *)    (((UInt8 *) w) + sizeof(GrafPort) + 0x5))
  746. #define GetWindowTitleWidth(w)                    ( *(SInt16 *)        (((UInt8 *) w) + sizeof(GrafPort) + 0x1E))
  747.  
  748. #if TARGET_OS_MAC
  749. #define IsWindowVisible MacIsWindowVisible 
  750. #define GetNextWindow MacGetNextWindow 
  751. #endif    /* TARGET_OS_MAC */
  752. #define SetPortWindowPort(w)                    MacSetPort( (GrafPtr) GetWindowPort(w) )
  753. #define GetWindowStructureRgn(w, aRgnHandle)    MacCopyRgn( *(RgnHandle *)(((UInt8 *) w) + sizeof(GrafPort) + 0x6), aRgnHandle )
  754. #define GetWindowContentRgn(w, aRgnHandle)        MacCopyRgn( *(RgnHandle *)(((UInt8 *) w) + sizeof(GrafPort) + 0xA), aRgnHandle )
  755. #define GetWindowUpdateRgn(w, aRgnHandle)        MacCopyRgn( *(RgnHandle *)(((UInt8 *) w) + sizeof(GrafPort) + 0xE), aRgnHandle )
  756. #define MacIsWindowVisible(w)                    ( *(Boolean *)    (((UInt8 *) w) + sizeof(GrafPort) + 0x2))
  757. #define MacGetNextWindow(w)                    ( *(WindowPtr *)    (((UInt8 *) w) + sizeof(GrafPort) + 0x24))
  758. #define GetWindowStandardState(w, aRectPtr)    do { Rect *stateRects = (  (Rect *) (**(Handle *) (((UInt8 *) w) + sizeof(GrafPort) + 0x16)));    \
  759.                                                                 if (stateRects != NULL)    *aRectPtr = stateRects[1]; } while (false)
  760. #define SetWindowStandardState(w, aRectPtr)    do { Rect *stateRects = (  (Rect *) (**(Handle *) (((UInt8 *) w) + sizeof(GrafPort) + 0x16)));    \
  761.                                                                 if (stateRects != NULL)    stateRects[1] = *aRectPtr; } while (false)
  762. #define GetWindowUserState(w, aRectPtr)        do { Rect *stateRects = (  (Rect *) (**(Handle *) (((UInt8 *) w) + sizeof(GrafPort) + 0x16)));    \
  763.                                                                 if (stateRects != NULL)    *aRectPtr = stateRects[0]; } while (false)
  764. #define SetWindowUserState(w, aRectPtr)        do { Rect *stateRects = (  (Rect *) (**(Handle *) (((UInt8 *) w) + sizeof(GrafPort) + 0x16)));    \
  765.                                                                 if (stateRects != NULL)    stateRects[0] = *aRectPtr; } while (false)
  766. #endif  /*  defined(__cplusplus)  */
  767.  
  768.  
  769.  
  770.  
  771.  
  772.  
  773.  
  774.  
  775.  
  776. #if PRAGMA_STRUCT_ALIGN
  777.     #pragma options align=reset
  778. #elif PRAGMA_STRUCT_PACKPUSH
  779.     #pragma pack(pop)
  780. #elif PRAGMA_STRUCT_PACK
  781.     #pragma pack()
  782. #endif
  783.  
  784. #ifdef PRAGMA_IMPORT_OFF
  785. #pragma import off
  786. #elif PRAGMA_IMPORT
  787. #pragma import reset
  788. #endif
  789.  
  790. #ifdef __cplusplus
  791. }
  792. #endif
  793.  
  794. #endif /* __MACWINDOWS__ */
  795.  
  796.